<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Services\Mqtt\Publishs;
use App\Services\Machine\Setting as MachineSetting;


class MachineConfig extends Model
{
    protected $fillable = [
    	'machine_id','title','key','state','value','start','end'
    ];


    public function mqttPublish($machine_id)
    {
    	$machine = (new Machine)->with('config')->find($machine_id);
        if($machine){
            (new MachineSetting)->store($machine);
        }
    }
}
